-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Make ImageFiltering.imfilter
pipeline differentiable
#21
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #21 +/- ##
===========================================
- Coverage 88.23% 55.55% -32.68%
===========================================
Files 3 4 +1
Lines 102 162 +60
===========================================
Hits 90 90
- Misses 12 72 +60
Continue to review full report at Codecov.
|
Yeah you definitely want the Tangent to wrap an array and not elements I would imagine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this up! Looking forward to the tests. I'll also take a look through the adjoints to see if they're correct
z) | ||
y = __imfilter_inbounds!(r, out, A, kern, border, R, z) | ||
function ∇__imfilter_inbounds!(Δy) | ||
# ∇out should not have any gradients |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it will be used further down in the computation pipeline, i think you still need to provide it the gradient so it can be accumulated properly. Else the answer would be incorrect
y = imfilter!(out, img, kernel, border, alg) | ||
function ∇imfilter!_try(Δy) | ||
k = default_resource(alg_defaults(alg, out, kernel)) | ||
ret = imfilter!(k, out, img, kernel, border) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true generically?
This PR aims to make the
ImageFiltering.imfilter
function differentiable.The current issue I am facing causes the gradient of the kernel to be
nothing
. There seems to be a place where I have incorrectly put aNoTangent()
, or a@nograd
. Infact upon some further tracing I found out it does go inside the rule of__imfilter_inbounds!
, but never calls the pullback inside it.The
img
gradient is incorrect too, and I shall get it rectified when I write tests and figure out the kernel thing.